package com.kmu.lwl.imp.impl;

import com.kmu.lwl.entiy.Login;
import com.kmu.lwl.factory.HibernateFactory;
import com.kmu.lwl.imp.LoginDao;
import org.hibernate.Session;
import org.hibernate.query.Query;

public class LoginDaoimpl implements LoginDao {


    @Override
    public Login delidate(String loginName, String loginPwd) {
        Session session = HibernateFactory.getSession();
        session.beginTransaction();
        Query query = session.createQuery("from Login where loginName=?1 and loginPassword=?2").setParameter(1, loginName).setParameter(2, loginPwd).setMaxResults(1);
        Login login = (Login) query.uniqueResult();
        return login;
    }
}
